home *** CD-ROM | disk | FTP | other *** search
- Path: amaryllisp1.appsig.com!user
- From: larry_kearney@appsig.com (Larry Kearney)
- Newsgroups: comp.lang.c
- Subject: Re: hex to dec function?
- Date: Fri, 23 Feb 1996 08:06:46 -0700
- Organization: Who ever said I was organized?
- Message-ID: <larry_kearney-2302960806460001@amaryllisp1.appsig.com>
- References: <4gdh1b$bg@mailhost.mwmicro.com>
- NNTP-Posting-Host: amaryllisp1.appsig.com
-
- In article <4gdh1b$bg@mailhost.mwmicro.com>, aschlies@citynet.net wrote:
-
- > Hi There,
- >
- > Is there a function that converts HEX to Dec in ANSI C?
- >
- > Why re-invent the wheel?
- >
- > Thanks
- > Tony
-
- I assume you mean convert a character string containing hex digits
- ('A'-'F','0'-'9') into a decimal integer. If so, use
-
- unsigned int int_value;
- unsigned long int long_int_value;
- char *string_buffer;
-
- ...
-
- sscanf( string_buffer, "%x", int_value );
-
- sscanf( string_buffer, "%lx", long_int_value );
-
- --
- Larry Kearney | "You want fries with that?"
- Applied Signal Technology |
- larry_kearney@appsig.com |
-